<?php

namespace application\district\controller;

use ticky\controller;

class index extends controller {

    /**
     * 出生地
     */
    public function birthdistrictbox() {

    }

    /**
     * 居住地
     */
    public function residedistrictbox() {

    }

    public function fetch_all_by_upid($upid, $order = null, $sort = 'DESC') {
        $upid = is_array($upid) ? array_map('intval', (array) $upid) : dintval($upid);
        if ($upid !== null) {
            $ordersql = $order !== null && !empty($order) ? ' ORDER BY ' . DB::order($order, $sort) : '';
            return db('district')->where("upid in(" . $upid . ")")->order($ordersql)->select();
        }
        return array();
    }

}
